(function () {
    "use strict";

    angular.module('core').factory('cartaoReceberService', factory);
    factory.$inject = ['$http', '$q'];

    function factory($http, $q) {

        return {
            get: function (id) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/get', id)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            getAll: function (args) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/getall', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            count: function (args) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/count', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            getParcelaCartaoReceber: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/cartaoReceber/getParcelaCartaoReceber', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            getAllParcelaCartaoReceber: function (args) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/getAllParcelaCartaoReceber', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            countParcelaCartaoReceber: function (args) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/countParcelaCartaoReceber', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            totalizeParcelaCartaoReceber: function (args) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/totalizeParcelaCartaoReceber', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            getLiquidacaoCartaoReceber: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/cartaoReceber/getLiquidacaoCartaoReceber', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            getAllLiquidacaoCartaoReceber: function (args) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/getAllLiquidacaoCartaoReceber', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            countLiquidacaoCartaoReceber: function (args) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/countLiquidacaoCartaoReceber', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            prepareNew: function () {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/prepareNew')
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            prepare: function (item) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/prepare', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            prepareNewParcelaCartaoReceber: function (item) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/prepareNewParcelaCartaoReceber', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            prepareParcelaCartaoReceber: function (item) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/prepareParcelaCartaoReceber', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            prepareNewLiquidacaoCartaoReceber: function (item) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/prepareNewLiquidacaoCartaoReceber', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            prepareLiquidacaoCartaoReceber: function (item) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/prepareLiquidacaoCartaoReceber', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            save: function (item) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/save', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            delete: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/cartaoReceber/delete', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            saveParcelaCartaoReceber: function (item) {
                var deferred = $q.defer();
                $http.post('/cartaoReceber/saveParcelaCartaoReceber', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            deleteParcelaCartaoReceber: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/cartaoReceber/deleteParcelaCartaoReceber', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
        };
    }

})();


